<?php

/**
 * SocialEngine
 *
 * @category   Application_Extensions
 * @package    Sitepage
 * @copyright  Copyright 2010-2011 BigStep Technologies Pvt. Ltd.
 * @license    http://www.socialengineaddons.com/license/
 * @version    $Id: Controller.php 2011-05-05 9:40:21Z SocialEngineAddOns $
 * @author     SocialEngineAddOns
 */
class Sitepage_Widget_InformationSitepageController extends Engine_Content_Widget_Abstract {

  public function indexAction() {

    if (!Engine_Api::_()->core()->hasSubject()) {
      return $this->setNoRender();
    }

    $this->view->sitepage = $sitepage = Engine_Api::_()->core()->getSubject('sitepage_page');
    $categoriesNmae = Engine_Api::_()->getDbTable('categories', 'sitepage')->getCategory($sitepage->category_id);
    if (!empty($categoriesNmae->category_name)) {
      $this->view->category_name = $categoriesNmae->category_name;
    }
    $subcategory_name = Engine_Api::_()->getDbTable('categories', 'sitepage')->getCategory($sitepage->subcategory_id);
    if (!empty($subcategory_name->category_name)) {
      $this->view->subcategory_name = $subcategory_name->category_name;
    }
    //GET SUB-SUB-CATEGORY
    $subsubcategory_name = Engine_Api::_()->getDbTable('categories', 'sitepage')->getCategory($sitepage->subsubcategory_id);
    if (!empty($subsubcategory_name->category_name)) {
      $this->view->subsubcategory_name = $subsubcategory_name->category_name;
    }
    $this->view->sitepageTags = $sitepage->tags()->getTagMaps();
  }
}
?>